<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>    
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>查询-Sharing Your Story</title>
		<link rel="Shortcut Icon" href="public/img/favicon.ico" />
		<link rel="stylesheet" href="public/bootstrap/css/bootstrap.min.css" />
		<script src="public/js/jquery-3.2.1.min.js"></script>
		<script src="public/bootstrap/js/bootstrap.min.js"></script>
		<link rel="stylesheet" href="public/css/style.css" />
		<script src="public/js/holder.min.js"></script>
	</head>
	<script type="text/javascript">
		function downloadFile(fileId, upUser){
	        var url = "${pageContext.request.contextPath}/homeAsy?method=download";
	        var fileName = upUser+fileId;
	        var form = $("<form></form>").attr("action", url).attr("method", "post");
	        form.append($("<input></input>").attr("type", "hidden").attr("name", "fileId").attr("value", fileName));
	        form.appendTo('body').submit().remove();
		}
	</script>
	<style>
		th, td{
			width: 300px;
			text-align: center;
		}
	</style>
	<body>
		<!--顶部效果-->
		<%@ include file= "/WEB-INF/zpublicpages/header.jsp" %>
		<div class="container" style="margin-top: 10px; font-size: 20px; line-height:40px;">
			<table cellpadding="1px" style="margin: 0 auto;">
				<tr>
					<th style="width:600px;">文件名</th>
					<th style="width:250px;">上传者</th>
					<th style="width:150px;">大小</th>
					<th style="width:300px;">上传时间</th>
				</tr>
				<c:forEach items="${requestScope.searchFiles}" var="file">
					<tr>
						<td>
							<button onclick="downloadFile('${file.fileId}', '${file.upUser}')"
								 style="border:0px;background-color:transparent;">
								${file.fileId}
							</button>
						</td>
						<td>${file.upUser}</td>
						<td>${file.size}&nbsp;kb</td>
						<td>${file.upTime}</td>
					</tr>
				</c:forEach>
			</table>
		</div>
		
		<!--底部效果-->
		<%@ include file="/WEB-INF/zpublicpages/footer.jsp"%>
	</body>
</html>